package com.itheima.service.impl.oms;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.mapper.oms.OmsOrderSettingMapper;

import com.itheima.pojo.oms.OmsOrderSetting;
import com.itheima.service.oms.OmsOrderSettingSrevice;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;
import java.util.stream.Collectors;

@DubboService
public class OmsOrderSettingSreviceImpl  extends ServiceImpl<OmsOrderSettingMapper, OmsOrderSetting> implements OmsOrderSettingSrevice {


    /*修改指定订单设置*/
    @Override
    public void updateID(int id, OmsOrderSetting omsOrderSetting) {
        LambdaQueryWrapper<OmsOrderSetting> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(OmsOrderSetting::getId,id);
        List<OmsOrderSetting> list = this.list(queryWrapper);
        List<OmsOrderSetting> list1 = list.stream().map(item->{
            item.setConfirmOvertime(omsOrderSetting.getConfirmOvertime());
            item.setCommentOvertime(omsOrderSetting.getCommentOvertime());
            item.setFinishOvertime(omsOrderSetting.getFinishOvertime());
            item.setFlashOrderOvertime(omsOrderSetting.getFlashOrderOvertime());
            item.setNormalOrderOvertime(omsOrderSetting.getNormalOrderOvertime());
            return item;
        }).collect(Collectors.toList());
        this.updateBatchById(list1);
    }
}
